package com.example.pjy.controller;

import com.example.pjy.pojo.Result;
import com.example.pjy.pojo.Studentin2;
import com.example.pjy.pojo.Studentin3;
import com.example.pjy.service.Studentin2Service;
import com.example.pjy.service.Studentin3Service;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/studentin3")
public class Studentin3Contrroller {
    @Resource
    private Studentin3Service studentin3Service;


    @GetMapping("/selectlist")
    public Result<List<Studentin3>>selectlist(){
        List<Studentin3> st3= studentin3Service.list();
        return Result.success(st3);//结果是数组
    }

    //计算研二学生每人分数
    @PostMapping("/total")
    public Result total(Integer year){
        studentin3Service.calTotalScore(year);
        studentin3Service.calAward(year);
        return Result.success();
    }



    //计算分数后更改研二分数字段
    @PutMapping("/updatest3")
    public Result updatest3(Studentin3 studentin3){
        studentin3Service.updatest3(studentin3);
        return Result.success();
    }
}
